﻿//======================================================
//==     (c)2008 aspxcms inc by NeTCMS v1.0              ==
//==          Forum:bbs.aspxcms.com                   ==
//==         Website:www.aspxcms.com                  ==
//======================================================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NetCMS.Content;

public partial class user_discussacti_up : NetCMS.Web.UI.UserPage
{
    //连接数据库
    Discuss dis = new Discuss();
    protected void Page_Load(object sender, EventArgs e)
    {
        
        if (!IsPostBack)
        {
            string AId = "";
            if (Request.QueryString["AId"] != "" && Request.QueryString["AId"] != null)
            {
                AId =Request.QueryString["AId"];
            }
            else 
            {
                PageError("对不起数据错误", "discussacti_list.aspx");
            }
            DataTable dt = dis.sel_discussInfo(AId,5);
            this.ActivesubjectBox.Text = dt.Rows[0]["Activesubject"].ToString();
            this.ActivePlaceBox.Text = dt.Rows[0]["ActivePlace"].ToString();
            this.CutofftimeBox.Text = DateTime.Parse(dt.Rows[0]["Cutofftime"].ToString()).ToShortDateString();
            this.AnumBox.Text = dt.Rows[0]["Anum"].ToString();
            this.ActiveExpenseBox.Text = dt.Rows[0]["ActiveExpense"].ToString();
            this.ContactmethodBox.Text = dt.Rows[0]["Contactmethod"].ToString();
            this.ActivePlanBox.Text = dt.Rows[0]["ActivePlan"].ToString();
            
            if (dt.Rows[0]["ALabel"].ToString() != "")
            {
                int ALabelsa = Convert.ToInt32(dt.Rows[0]["ALabel"].ToString());//会员性别
                switch (ALabelsa)
                {
                    case 0:
                        this.ALabelList.Items[0].Selected = true;
                        break;
                    case 1:
                        this.ALabelList.Items[1].Selected = true;
                        break;
                }
            }
        }
    }

    protected void inBox_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)//判断是否通过验证
        {
            string AIds = Request.QueryString["AId"];
            string Activesubject = Request.Form["ActivesubjectBox"].ToString();
            string ActivePlace =Request.Form["ActivePlaceBox"].ToString();
            int Anum = int.Parse(Request.Form["AnumBox"].ToString());
            string ActivePlan =Request.Form["ActivePlanBox"].ToString();
            string Contactmethod =Request.Form["ContactmethodBox"].ToString();
            DateTime Cutofftime = DateTime.Parse(Request.Form["CutofftimeBox"].ToString());
            string ActiveExpense =Request.Form["ActiveExpenseBox"].ToString();
            int ALabel = this.ALabelList.SelectedIndex;
            DateTime CreaTime = DateTime.Now;//获取当前系统时间
            if (dis.update_disActive(Activesubject, ActivePlace, ActiveExpense, Anum, ActivePlan, Contactmethod, Cutofftime, CreaTime, ALabel, AIds) != 0)
            {
                PageRight("修改成功", "discussacti_list.aspx");
            }
            else
            {
                PageError("修改失败", "discussacti_list.aspx");
            }
        }
    }
}